const app    = require('koa')(),
      router = require('koa-router')();

router.get('/', function *(next) {
    this.body = 'Hello World!';
});

// http://localhost:3000/12?aaaaa=1&bbbbb=2
router.get('/:id(\\d+)', function *(next) {
    console.log(this.params); // {id: '12'}
    console.log(this.request.query); // {aaaaa: '1', bbbbb: '2'}
    this.body = `id is ${this.params.id}`;
});

app
    .use(router.routes())
    .use(router.allowedMethods());

app.listen(3000);